﻿@using Orchard.DynamicForms.Elements
@using Orchard.Layouts.Helpers
@{
    var tagBuilder = TagBuilderExtensions.CreateElementTagBuilder(Model);
    var element = (ReCaptcha)Model.Element;
    var publicKey = (string)Model.PublicKey;
}
@if (!String.IsNullOrWhiteSpace(publicKey)) {
    @tagBuilder.StartElement
    <script type="text/javascript" src="//www.google.com/recaptcha/api/challenge?k=@publicKey"></script>
    <noscript>
        <iframe src="//www.google.com/recaptcha/api/noscript?k=@publicKey" height="280" width="500" frameborder="0"></iframe><br>
        <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
        <input type="hidden" name="recaptcha_response_field" value="manual_challenge">
    </noscript>
    @tagBuilder.EndElement
    if (element.ValidationSettings.ShowValidationMessage == true) {
        @Html.ValidationMessage("recaptcha_response_field")
    }
}